<script>
function checkform(){
	var subject=$('input[name="ltitle"]').val();
	if(trim(subject)==''){
		alert('请填写名称!');
		return false;
	}

	commonEffection.setLoading();
	$('#addBulletinForm').submit();
}
	upload.type='lagnappe';
	upload.formid='addBulletinForm';
	upload.setAppend=function(imgurl){
		return '<div style="margin:10px"><a href="'+imgurl+'" target="_blank"><img style="height:100px;width:100px;vertical-align:middle;border:1px #cccccc dashed" src="'+imgurl+'" /></a> 图片说明:<input type="text" name="imgIntro[]" value="" /><input type="hidden" name="imgUrl[]" value="'+imgurl+'" />　<input type="button" value="插入" onclick="commonEffection.InserImg(\''+imgurl+'\');" />　<input type="button" value="删除" onclick="upload.delimg(this);" /></div>';
	}
</script>
<div class="frame_addfactoryDiv">
  <form name="addBulletinForm" id="addBulletinForm" enctype="multipart/form-data"  action="administrator<?=CHOSING_DE?>lagnappe<?=CHOSING_DE?>doedit?pid=<?=$this->oneLagnappeArray[0]['pid']?>&itemid=<?=$this->oneLagnappeArray[0]['itemid']?>" method="post">
  <table width="100%" border="1" cellpadding="0" cellspacing="0" bordercolor="#c8d9e9">
    <tr>
      <td width="15%" class="ri-bbgg"><span class="red">*</span> 赠品名称：</td>
      <td width="85%" class="le">
          <input type="text" name="ltitle" size="50" value="<?=$this->oneLagnappeArray[0]['ltitle']?>" id="ltitle">
	  </td>
    </tr>
     <tr>
      <td width="15%" class="ri-bbgg"><span class="red">*</span> 价钱：</td>
      <td width="85%" class="le">
	  	<input type="text" name="price" maxlength="30" size="50" value="<?=$this->oneLagnappeArray[0]['price']?>" id="price">
	  </td>
    </tr>
    <tr>
      <td width="15%" class="ri-bbgg"><span class="red">*</span> 要求购买量：</td>
      <td width="85%" class="le">
	  	<input type="text" name="min_counts" maxlength="30" size="50" value="<?=$this->oneLagnappeArray[0]['min_counts']?>" id="min_counts">
	  </td>
    </tr>
 
    <tr>
      <td class="ri-bbgg">描述：</td>
      <td class="le">
        <div>
            <textarea name="linfo" id="linfo" cols="60" rows="12" style="display:none"><?=$this->oneLagnappeArray[0]['linfo']?></textarea><input type="hidden" id="linfo___Config" value="" style="display:none" /><iframe id="linfo___Frame" src="/fckeditor/editor/fckeditor.html?InstanceName=linfo&amp;Toolbar=Default" width="98%" height="400" frameborder="0" scrolling="no"></iframe>
        </div>
	  </td>
    </tr>
   <tr>
		  <td colspan="7" class="se">
		  	<div>规格大小: <input type="button" onclick="addPatternSize(this);" value="添加" /></div>
			<?foreach($this->pattern_size as $value):?>
			<div><input name="pattern_size[]" value="<?=$value?>" /> <input type="button" onclick="deletePatternSize(this);" value="删除" /></div>
			<?endforeach;?>
		  </td>
		</tr>
	<tr>
	  <td class="ri-bbgg"><span class="red">*</span>图片：</td>
	  <td class="le"><span><input name="productpic" type="file" id="productpic" /></span>　<input type="button" onclick="upload.uploadimg(this);" value="上传" /> ( 可连续上传三幅 ) </td>
	</tr>
	<tr>
	  <td class="ri-bbgg">图片效果：</td>
	  <td class="le">
		<div id="productImages">
                    <?for($i=0;$i<count($this->attachmentArray);$i++):?>
				<div style="margin:10px"><a href="<?=$this->attachmentArray[$i]['attachment_url']?>" target="_blank"><img style="height:100px;vertical-align:middle;border:1px #cccccc dashed" src="<?=$this->attachmentArray[$i]['attachment_url']?>" /></a> 图片说明:<input type="text" name="imgIntro[]" value="<?=$this->attachmentArray[$i]['intro']?>" /><input type="hidden" name="imgUrl[]" value="<?=$this->attachmentArray[$i]['attachment_url']?>" />　<input type="button" value="删除" onclick="upload.delimgbyid(this);" /><input type="hidden" value="<?=$this->attachmentArray[$i]['attachmentid']?>" name="attachmentid[]" /></div>
		    <?endfor;?>                            
                </div>
		<iframe id="productIframe" width="0" height="0" name="productIframe"></iframe>
	  </td>
	</tr>
     <tr>
      <td width="15%" class="ri-bbgg"><span class="red">*</span> 是否公开：</td>
      <td width="85%" class="le">
	  	<select name="openflag" id="openflag">
                    <option value="1" <?if ($this->oneLagnappeArray[0]['openflag']==1){?> selected <?}?>>是</option>
                    <option value="0" <?if ($this->oneLagnappeArray[0]['openflag']==0){?> selected <?}?>>否</option>
                </select>
	  </td>
    </tr>
    <tr>
      <td colspan="2" class="se" align="center">
        <input name="button2" type="button" class="iput" value="保 存"   onclick="checkform();" />　　
        <input name="button" type="button" class="iput" value="返 回" onclick="commonEffection.confirmBack();" />
      </td>
    </tr>
  </table>
</div>
<script>
	function addPatternSize(thisInput){
		$(thisInput).parent().parent().append('<div><input name="pattern_size[]" /> <input type="button" onclick="deletePatternSize(this);" value="删除" /></div>');
		commonEffection.resetFrame('admins_frame',true);
	}
	function deletePatternSize(thisInput){
		$(thisInput).parent().remove();
		commonEffection.resetFrame('admins_frame',true);
	}
</script>